<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>rippleButton</title>
    <style>
        body,
        html {
            height: 100%;
        }

        body {
            margin: 0;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .btn {
            padding: 6px 12px;
            border: none;
            border-radius: 8px;
            display: inline-block;
            background: linear-gradient(135deg, #eceef0 10%, #818385 90%);
            color: #2b2a2a;
            cursor: pointer;
        }

        .btn:hover {
            background: linear-gradient(135deg, #62a6eb 10%, #2a8ff5 90%);
            color: #fff;
        }

        .circle {
            width: 100px;
            height: 100px;
            transform: translate(-50%, -50%) scale(0);
            transition: all 0.3s cubic-bezier(0.075, 0.82, 0.165, 1);
            position: absolute;
            background-image: linear-gradient(to left, #c0e2f0, #66a7f1), radial-gradient(circle, #c0bff3, #7e89ec);
            border-radius: 50%;
            animation: scale 0.3s ease-in-out;
        }

        @keyframes scale {
            to {
                transform: translate(-50%, -50%) scale(3);
                opacity: 0;
            }
        }
    </style>
</head>

<body>
    <button id="btn" type="button" class="btn">clicked me</button>
    <script>
        const rippleButton = btn => {
            btn.addEventListener('click', e => {
                const x = e.clientX,
                    y = e.clientY,
                    left = btn.offsetLeft,
                    top = btn.offsetTop,
                    cX = x - left,
                    cY = y - top;
                const span = document.createElement('span');
                span.classList.add('circle');
                btn.appendChild(span);
                setTimeout(() => span.remove(), 1000);
            });
        };
        rippleButton(document.querySelector('#btn'))
    </script>
</body>

</html>